/*
 * @lc app=leetcode.cn id=392 lang=javascript
 *
 * [392] 判断子序列
 */

// @lc code=start
/**
 * @param {string} s
 * @param {string} t
 * @return {boolean}
 */
// var isSubsequence = function(s, t) {
//   if(s.length > t.length) return false;
//     let i = 0;
//     for (let j = 0; j < t.length; j++) {
//       if(t[j] !== s[i]) continue;
//       i++;
//     }
//   return i === s.length;
// };
var isSubsequence = function(s, t) {
  if(s.length > t.length) return false;
  let i = 0, j = 0;
  while(t[j] !== undefined) i += (t[j++] === s[i]);
  return i === s.length;
};
// @lc code=end

